﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.IO;
using Golden.Gegerla.Service.Upload.DataContract;

namespace Golden.Gegerla.Service.Upload.ServiceContract
{
    /// <summary>
    /// Upload Service Interface Service Contract 
    /// </summary>
    [ServiceContract(Namespace="http://schemas/Golden/Gegerla/ServiceContract/IUploadService/2010/07")]
    public interface IUploadService
    {
        /// <summary>
        /// Create a new Upload Session
        /// </summary>
        /// <returns>Returns an Upload Session object</returns>
        [OperationContract]
        UploadSession OpenUploadSession();

        /// <summary>
        /// Create a new File Upload Session
        /// </summary>
        /// <param name="uploadSession">Associated Upload Session</param>
        /// <param name="fileInfo">File Information Properties</param>
        /// <returns>Returns an Upload File Session object</returns>
        [OperationContract]
        UploadFileSession OpenFileUploadSession(UploadSession uploadSession, FileInfo fileInfo);

        /// <summary>
        /// Upload a Chunk of Data
        /// </summary>
        /// <param name="chunkData">Chunk Data as binary array</param>
        /// <param name="startPosition">Start Position of the Chunk Data</param>
        /// <param name="length">Length of Chunk Data</param>
        /// <param name="uploadFileSession">Associated Upload File Session</param>
        [OperationContract]
        void UploadChunk(byte[] chunkData, UploadFileSession uploadFileSession);

        /// <summary>
        /// Close a File Upload Session
        /// </summary>
        /// <param name="fileUploadSession">File Upload Session to be closed</param>
        [OperationContract]
        void CloseFileUploadSession(UploadFileSession fileUploadSession);

        /// <summary>
        /// Close Upload Session
        /// </summary>
        /// <param name="uploadSession">Upload Session to be closed</param>
        [OperationContract]
        void CloseUploadSession(UploadSession uploadSession);
    }
}
